<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
<title>Compute Library: NumPyBinLoader Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Compute Library
   &#160;<span id="projectnumber">18.05</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.xhtml"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
      <li><a href="classes.xhtml"><span>Data&#160;Structure&#160;Index</span></a></li>
      <li><a href="inherits.xhtml"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.xhtml"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">NumPyBinLoader Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Numpy Binary loader class.  
 <a href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_graph_utils_8h_source.xhtml">GraphUtils.h</a>&gt;</code></p>
<div class="dynheader">
Collaboration diagram for NumPyBinLoader:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader__coll__graph.svg" width="143" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a target="top" href="graph_legend.xhtml">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:abf92dad7656a4a25c3aa3d1112ef06e5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml#abf92dad7656a4a25c3aa3d1112ef06e5">NumPyBinLoader</a> (std::string filename, <a class="el" href="namespacearm__compute.xhtml#ad1d5cce2d9e9a5d61c243e5c989112e0">DataLayout</a> file_layout=<a class="el" href="namespacearm__compute.xhtml#ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f">DataLayout::NCHW</a>)</td></tr>
<tr class="memdesc:abf92dad7656a4a25c3aa3d1112ef06e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default Constructor.  <a href="#abf92dad7656a4a25c3aa3d1112ef06e5">More...</a><br /></td></tr>
<tr class="separator:abf92dad7656a4a25c3aa3d1112ef06e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f32ab9a631e79fe364fed57a1d0145b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml#a4f32ab9a631e79fe364fed57a1d0145b">NumPyBinLoader</a> (<a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml">NumPyBinLoader</a> &amp;&amp;)=default</td></tr>
<tr class="memdesc:a4f32ab9a631e79fe364fed57a1d0145b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allows instances to move constructed.  <a href="#a4f32ab9a631e79fe364fed57a1d0145b">More...</a><br /></td></tr>
<tr class="separator:a4f32ab9a631e79fe364fed57a1d0145b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab469d593b4bc92e1d1132a03de0aedca"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml#ab469d593b4bc92e1d1132a03de0aedca">access_tensor</a> (<a class="el" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> &amp;tensor) override</td></tr>
<tr class="memdesc:ab469d593b4bc92e1d1132a03de0aedca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Interface to be implemented to access a given tensor.  <a href="#ab469d593b4bc92e1d1132a03de0aedca">More...</a><br /></td></tr>
<tr class="separator:ab469d593b4bc92e1d1132a03de0aedca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classarm__compute_1_1graph_1_1_i_tensor_accessor"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classarm__compute_1_1graph_1_1_i_tensor_accessor')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classarm__compute_1_1graph_1_1_i_tensor_accessor.xhtml">ITensorAccessor</a></td></tr>
<tr class="memitem:a3c7f21c2eb00ab7ae1c18b1418c0d9c6 inherit pub_methods_classarm__compute_1_1graph_1_1_i_tensor_accessor"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph_1_1_i_tensor_accessor.xhtml#a3c7f21c2eb00ab7ae1c18b1418c0d9c6">~ITensorAccessor</a> ()=default</td></tr>
<tr class="memdesc:a3c7f21c2eb00ab7ae1c18b1418c0d9c6 inherit pub_methods_classarm__compute_1_1graph_1_1_i_tensor_accessor"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default virtual destructor.  <a href="#a3c7f21c2eb00ab7ae1c18b1418c0d9c6">More...</a><br /></td></tr>
<tr class="separator:a3c7f21c2eb00ab7ae1c18b1418c0d9c6 inherit pub_methods_classarm__compute_1_1graph_1_1_i_tensor_accessor"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Numpy Binary loader class. </p>

<p>Definition at line <a class="el" href="_graph_utils_8h_source.xhtml#l00232">232</a> of file <a class="el" href="_graph_utils_8h_source.xhtml">GraphUtils.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="abf92dad7656a4a25c3aa3d1112ef06e5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml">NumPyBinLoader</a> </td>
          <td>(</td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespacearm__compute.xhtml#ad1d5cce2d9e9a5d61c243e5c989112e0">DataLayout</a>&#160;</td>
          <td class="paramname"><em>file_layout</em> = <code><a class="el" href="namespacearm__compute.xhtml#ad1d5cce2d9e9a5d61c243e5c989112e0a6b99f356fe3b30a2a850b5ea897c289f">DataLayout::NCHW</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Default Constructor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">filename</td><td>Binary file name </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">file_layout</td><td>(Optional) Layout of the numpy tensor data. Defaults to NCHW </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_graph_utils_8cpp_source.xhtml#l00392">392</a> of file <a class="el" href="_graph_utils_8cpp_source.xhtml">GraphUtils.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;    : _filename(std::move(filename)), _file_layout(file_layout)</div><div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;{</div><div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a4f32ab9a631e79fe364fed57a1d0145b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml">NumPyBinLoader</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml">NumPyBinLoader</a> &amp;&amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Allows instances to move constructed. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab469d593b4bc92e1d1132a03de0aedca"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool access_tensor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classarm__compute_1_1_i_tensor.xhtml">ITensor</a> &amp;&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Interface to be implemented to access a given tensor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">tensor</td><td><a class="el" href="classarm__compute_1_1_tensor.xhtml" title="Basic implementation of the tensor interface. ">Tensor</a> to be accessed</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if access is successful else false </dd></dl>

<p>Implements <a class="el" href="classarm__compute_1_1graph_1_1_i_tensor_accessor.xhtml#a497873c25847d7b4f60f37a1a3aa7665">ITensorAccessor</a>.</p>

<p>Definition at line <a class="el" href="_graph_utils_8cpp_source.xhtml#l00397">397</a> of file <a class="el" href="_graph_utils_8cpp_source.xhtml">GraphUtils.cpp</a>.</p>

<p>References <a class="el" href="_error_8h_source.xhtml#l00319">ARM_COMPUTE_ERROR_ON_MSG</a>, <a class="el" href="classarm__compute_1_1_i_tensor.xhtml#ab988210662dbd3bf32fd563c7dd1bdbf">ITensor::buffer()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a367b5090ab432bc7de2c32369e087ab1">ITensorInfo::data_layout()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a7cfb31af63202568efef5214acfbf3ba">ITensorInfo::data_type()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#aa459796b5489eca8a9160cb5dcf1a103">ITensorInfo::element_size()</a>, <a class="el" href="arm__compute_2core_2_types_8h_source.xhtml#l00318">BorderSize::empty()</a>, <a class="el" href="_helpers_8inl_source.xhtml#l00122">arm_compute::execute_window_loop()</a>, <a class="el" href="utils_2_utils_8h_source.xhtml#l00128">arm_compute::utils::get_typestring()</a>, <a class="el" href="classarm__compute_1_1_i_tensor.xhtml#a0e95dc1e53c361348314873b168ae237">ITensor::info()</a>, <a class="el" href="_dimensions_8h_source.xhtml#l00122">Dimensions&lt; T &gt;::num_dimensions()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a07b929c34ad1dc823d8315876aa403ce">ITensorInfo::padding()</a>, <a class="el" href="arm__compute_2core_2_helpers_8h_source.xhtml#l00536">arm_compute::permute()</a>, <a class="el" href="_i_tensor_8h_source.xhtml#l00063">ITensor::ptr_to_element()</a>, <a class="el" href="_c_l_2_convolution_8cpp_source.xhtml#l00133">arm_compute::test::validation::shape</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a7c66505457d00ece3aa4b34cab80757d">ITensorInfo::tensor_shape()</a>, <a class="el" href="classarm__compute_1_1_i_tensor_info.xhtml#a18064e0011c3869d884653e9e7c47b66">ITensorInfo::total_size()</a>, and <a class="el" href="_window_8inl_source.xhtml#l00240">Window::use_tensor_dimensions()</a>.</p>

<p>Referenced by <a class="el" href="_graph_utils_8cpp_source.xhtml#l00132">NumPyAccessor::NumPyAccessor()</a>.</p>
<div class="fragment"><div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;{</div><div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;    <span class="keyword">const</span> TensorShape          tensor_shape = tensor.info()-&gt;tensor_shape();</div><div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    std::vector&lt;unsigned long&gt; <a class="code" href="namespacearm__compute_1_1test_1_1validation.xhtml#a45cde9abb508c62d67c3bb2b9bf566a5">shape</a>;</div><div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;</div><div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    <span class="comment">// Open file</span></div><div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;    std::ifstream stream(_filename, std::ios::in | std::ios::binary);</div><div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;    <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(!stream.good(), <span class="stringliteral">&quot;Failed to load binary data&quot;</span>);</div><div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;    std::string header = npy::read_header(stream);</div><div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;</div><div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;    <span class="comment">// Parse header</span></div><div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;    <span class="keywordtype">bool</span>        fortran_order = <span class="keyword">false</span>;</div><div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;    std::string typestr;</div><div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    npy::parse_header(header, typestr, fortran_order, shape);</div><div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;</div><div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;    <span class="comment">// Check if the typestring matches the given one</span></div><div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    std::string expect_typestr = <a class="code" href="namespacearm__compute_1_1utils.xhtml#a7990fd2b875e2f6d4c1eded54539cb19">arm_compute::utils::get_typestring</a>(tensor.info()-&gt;data_type());</div><div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;    <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(typestr != expect_typestr, <span class="stringliteral">&quot;Typestrings mismatch&quot;</span>);</div><div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;</div><div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;    <span class="comment">// Reverse vector in case of non fortran order</span></div><div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;    <span class="keywordflow">if</span>(!fortran_order)</div><div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;    {</div><div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;        std::reverse(shape.begin(), shape.end());</div><div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;    }</div><div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;</div><div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;    <span class="comment">// Correct dimensions (Needs to match TensorShape dimension corrections)</span></div><div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;    <span class="keywordflow">if</span>(shape.size() != tensor_shape.num_dimensions())</div><div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;    {</div><div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = static_cast&lt;int&gt;(shape.size()) - 1; i &gt; 0; --i)</div><div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;        {</div><div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;            <span class="keywordflow">if</span>(shape[i] == 1)</div><div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;            {</div><div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;                shape.pop_back();</div><div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;            }</div><div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;            <span class="keywordflow">else</span></div><div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;            {</div><div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;                <span class="keywordflow">break</span>;</div><div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;            }</div><div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;        }</div><div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;    }</div><div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;</div><div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;    <span class="keywordtype">bool</span> are_layouts_different = (_file_layout != tensor.info()-&gt;data_layout());</div><div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;</div><div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;    <span class="comment">// Validate tensor ranks</span></div><div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;    <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(shape.size() != tensor_shape.num_dimensions(), <span class="stringliteral">&quot;Tensor ranks mismatch&quot;</span>);</div><div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;</div><div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;    <span class="comment">// Set permutation parameters if needed</span></div><div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;    TensorShape                    permuted_shape = tensor_shape;</div><div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;    <a class="code" href="classarm__compute_1_1_strides.xhtml">arm_compute::PermutationVector</a> perm;</div><div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;    <span class="keywordflow">if</span>(are_layouts_different)</div><div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;    {</div><div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;        std::tie(permuted_shape, perm) = compute_permutation_paramaters(tensor_shape, tensor.info()-&gt;data_layout());</div><div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;    }</div><div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;</div><div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;    <span class="comment">// Validate shapes</span></div><div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; shape.size(); ++i)</div><div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;    {</div><div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;        <a class="code" href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a>(permuted_shape[i] != shape[i], <span class="stringliteral">&quot;Tensor dimensions mismatch&quot;</span>);</div><div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;    }</div><div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;</div><div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;    <span class="comment">// Validate shapes and copy tensor</span></div><div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;    <span class="keywordflow">if</span>(!are_layouts_different || perm.<a class="code" href="classarm__compute_1_1_dimensions.xhtml#a0f59f175e7682c7ed5f4ea30ef687834">num_dimensions</a>() &lt;= 2)</div><div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;    {</div><div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;        <span class="comment">// Read data</span></div><div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;        <span class="keywordflow">if</span>(tensor.info()-&gt;padding().empty() &amp;&amp; (<span class="keyword">dynamic_cast&lt;</span>SubTensor *<span class="keyword">&gt;</span>(&amp;tensor) == <span class="keyword">nullptr</span>))</div><div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;        {</div><div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;            <span class="comment">// If tensor has no padding read directly from stream.</span></div><div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;            stream.read(reinterpret_cast&lt;char *&gt;(tensor.buffer()), tensor.info()-&gt;total_size());</div><div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;        }</div><div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;        {</div><div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;            <span class="comment">// If tensor has padding accessing tensor elements through execution window.</span></div><div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;            Window window;</div><div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;            window.use_tensor_dimensions(tensor_shape);</div><div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;</div><div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;            <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> Coordinates &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;            {</div><div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;                stream.read(reinterpret_cast&lt;char *&gt;(tensor.ptr_to_element(<span class="keywordtype">id</span>)), tensor.info()-&gt;element_size());</div><div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;            });</div><div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;        }</div><div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;    }</div><div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;    <span class="keywordflow">else</span></div><div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;    {</div><div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;        <span class="comment">// If tensor has padding accessing tensor elements through execution window.</span></div><div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;        Window window;</div><div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;        window.use_tensor_dimensions(permuted_shape);</div><div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;</div><div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;        <a class="code" href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">execute_window_loop</a>(window, [&amp;](<span class="keyword">const</span> Coordinates &amp; <span class="keywordtype">id</span>)</div><div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;        {</div><div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;            Coordinates coords(<span class="keywordtype">id</span>);</div><div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;            <a class="code" href="namespacearm__compute.xhtml#a21c3e11887f3acf9284ca763372c7da0">arm_compute::permute</a>(coords, perm);</div><div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;            stream.read(reinterpret_cast&lt;char *&gt;(tensor.ptr_to_element(coords)), tensor.info()-&gt;element_size());</div><div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;        });</div><div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    }</div><div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1test_1_1validation_xhtml_a45cde9abb508c62d67c3bb2b9bf566a5"><div class="ttname"><a href="namespacearm__compute_1_1test_1_1validation.xhtml#a45cde9abb508c62d67c3bb2b9bf566a5">arm_compute::test::validation::shape</a></div><div class="ttdeci">shape</div><div class="ttdef"><b>Definition:</b> <a href="_c_l_2_convolution_8cpp_source.xhtml#l00133">Convolution.cpp:133</a></div></div>
<div class="ttc" id="namespacearm__compute_xhtml_a21c3e11887f3acf9284ca763372c7da0"><div class="ttname"><a href="namespacearm__compute.xhtml#a21c3e11887f3acf9284ca763372c7da0">arm_compute::permute</a></div><div class="ttdeci">void permute(Dimensions&lt; T &gt; &amp;dimensions, const PermutationVector &amp;perm)</div><div class="ttdoc">Permutes given Dimensions according to a permutation vector. </div><div class="ttdef"><b>Definition:</b> <a href="arm__compute_2core_2_helpers_8h_source.xhtml#l00536">Helpers.h:536</a></div></div>
<div class="ttc" id="namespacearm__compute_1_1utils_xhtml_a7990fd2b875e2f6d4c1eded54539cb19"><div class="ttname"><a href="namespacearm__compute_1_1utils.xhtml#a7990fd2b875e2f6d4c1eded54539cb19">arm_compute::utils::get_typestring</a></div><div class="ttdeci">std::string get_typestring(DataType data_type)</div><div class="ttdoc">Obtain numpy type string from DataType. </div><div class="ttdef"><b>Definition:</b> <a href="utils_2_utils_8h_source.xhtml#l00128">Utils.h:128</a></div></div>
<div class="ttc" id="namespacearm__compute_xhtml_a6c0dcc38187027dcb89cd9724bc5a823"><div class="ttname"><a href="namespacearm__compute.xhtml#a6c0dcc38187027dcb89cd9724bc5a823">arm_compute::execute_window_loop</a></div><div class="ttdeci">void execute_window_loop(const Window &amp;w, L &amp;&amp;lambda_function, Ts &amp;&amp;...iterators)</div><div class="ttdoc">Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...</div><div class="ttdef"><b>Definition:</b> <a href="_helpers_8inl_source.xhtml#l00122">Helpers.inl:122</a></div></div>
<div class="ttc" id="classarm__compute_1_1_strides_xhtml"><div class="ttname"><a href="classarm__compute_1_1_strides.xhtml">arm_compute::Strides</a></div><div class="ttdoc">Strides of an item in bytes. </div><div class="ttdef"><b>Definition:</b> <a href="_strides_8h_source.xhtml#l00037">Strides.h:37</a></div></div>
<div class="ttc" id="classarm__compute_1_1_dimensions_xhtml_a0f59f175e7682c7ed5f4ea30ef687834"><div class="ttname"><a href="classarm__compute_1_1_dimensions.xhtml#a0f59f175e7682c7ed5f4ea30ef687834">arm_compute::Dimensions::num_dimensions</a></div><div class="ttdeci">unsigned int num_dimensions() const </div><div class="ttdoc">Returns the effective dimensionality of the tensor. </div><div class="ttdef"><b>Definition:</b> <a href="_dimensions_8h_source.xhtml#l00122">Dimensions.h:122</a></div></div>
<div class="ttc" id="_error_8h_xhtml_a5bbdcf574d3f5e412fa6a1117911e67b"><div class="ttname"><a href="_error_8h.xhtml#a5bbdcf574d3f5e412fa6a1117911e67b">ARM_COMPUTE_ERROR_ON_MSG</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON_MSG(cond,...)</div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00319">Error.h:319</a></div></div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>utils/<a class="el" href="_graph_utils_8h_source.xhtml">GraphUtils.h</a></li>
<li>utils/<a class="el" href="_graph_utils_8cpp_source.xhtml">GraphUtils.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacearm__compute.xhtml">arm_compute</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1graph__utils.xhtml">graph_utils</a></li><li class="navelem"><a class="el" href="classarm__compute_1_1graph__utils_1_1_num_py_bin_loader.xhtml">NumPyBinLoader</a></li>
    <li class="footer">Generated on Wed May 23 2018 11:36:43 for Compute Library by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
